from django.conf.urls.defaults import *
from django.conf import settings
from blog.blogapp.models import Article, Comment

articles = {
	'queryset': Article.objects.all(),
}

urlpatterns = patterns('',
	# Example:
	# (r'^blog/', include('blog.foo.urls')),
	(r'^admin/', include('django.contrib.admin.urls')),
	
	(r'^s/(?P<path>.*)$', 'django.views.static.serve', {'document_root': settings.STATIC_ROOT}),
	
	(r'^$', 'django.views.generic.list_detail.object_list', articles),

	(r'^addarticle/$', 'blog.blogapp.views.edit_article'),
	(r'^addarticle/(?P<slug>[^/]*)/$', 'blog.blogapp.views.add_article'),
		
	(r'^addcomment/(?P<slug>[^/]*)/$', 'blog.blogapp.views.add_comment'),

	(r'^(?P<slug>[^/]*)/$', 'django.views.generic.list_detail.object_detail', 
		dict(articles, slug_field='slug', template_object_name='article')),

)
